class classes.Audiences
{
	private var m_xmlPath:String;
	private var m_mcStage:MovieClip;
	private var m_xml:XML;
	private var m_arrInformation:Array;
	private var m_nCurrectIndex:Number;
	private var m_objFlvListner;
	private var m_strVideoPath:String;


	public function Audiences(mcStage:MovieClip, strXmlPath:String)
	{
		m_mcStage = mcStage;
		m_arrInformation = new Array();
		m_nCurrectIndex = -1;
		loadXml(strXmlPath);
	}

	private function loadXml(strXmlPath)
	{
		var objThis = this;
		m_xml = new XML();
		m_xml.ignoreWhite = true;
		m_xml.onLoad = function()
		{
			objThis.readXML();
		}
		m_xml.load(strXmlPath);
	}

	private function readXML()
	{
		var xmlInformation = m_xml.firstChild.childNodes[0];
		var nInformationLength = xmlInformation.childNodes.length;
		var arrPlatform = new Array();
		m_strVideoPath = xmlInformation.attributes.vidioPath;
		for(var i = 0; i < nInformationLength; i++)
		{

			m_arrInformation.push(xmlInformation.childNodes[i].firstChild.nodeValue);
		}
		setEvent();
	}


	private function setEvent()
	{
		m_objFlvListner = new Object();
		var objThis  = this;
		m_objFlvListner.cuePoint = function(eventObject:Object):Void
		{

			trace("eventObject.info.name == " + eventObject.info.name);
			objThis.m_nCurrectIndex++;
			objThis.m_mcStage.gotoAndPlay(eventObject.info.name);
			trace(objThis.m_mcStage  +     "stop_"+(objThis.m_nCurrectIndex+1) );

		};
		_root.flvPlayer.addEventListener("cuePoint",m_objFlvListner);
		_root.flvPlayer.contentPath =  m_strVideoPath;
		_root.flvPlayer.play();
		//m_mcStage.gotoAndPlay("strt");
	}

	public function get information():String
	{
		return m_arrInformation[m_nCurrectIndex];
	}

	public function playVideo()
	{
		_root.flvPlayer.play();
	}

	public function pauseVideo()
	{
		_root.flvPlayer.pause();
	}


	public function nextSegment()
	{
		trace("next segment -----------==========================-");
		_root.objUpFront.segmentIndex++;

	}
}